#include "MainWindow.h"
#include "ui_MainWindow.h"
#include <fstream>


void MainWindow::Save(const QString& xfile)
{
    std::ofstream out(xfile.toStdString().c_str());

    out << "$ ETA/DYNAFORM : LS-DYNA(971R5.x) INPUT DECK\n";
    out << "$ DATE : Mar 28, 2012 at 15:45:01\n";
    out << "$ VERSION : eta/DYNAFORM 5.8.1, built on Jan  5 2012\n";
    out << "$ EXPORTER : AUTO-SETUP\n";
    out << "$\n";
    out << "$ VIEWING INFORMATION\n";
    out << "$  390.0621338 1112.376465 -333.430511 -4.42476177\n";
    out << "$  0.806227565 0.051618367 -0.58934932\n";
    out << "$  -0.19297230 0.964630723 -0.17958083\n";
    out << "$  0.559271872 0.258500725  0.78764993\n";
    out << "$\n";
    out << "$ UNIT SYSTEM : MM, TON, SEC, N\n";
    out << "$\n";
    out << "$ SIMULATION  : SHEET FORMING                                               \n";
    out << "$ RCMD-SOLVER : SINGLE                                                      \n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "*KEYWORD_JOBID\n";
    out << "3\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (1) TITLE CARD\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*TITLE\n";
    out << ui->titleLineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (2) DEFINE PARAMETERS\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*PARAMETER\n";
    out << "$    PRMR1      VAL1     PRMR2      VAL2     PRMR3      VAL3     PRMR4      VAL4\n";
    out << std::string(VAL_DIST - ui->dpPRMR1lineEdit->text().length(), ' ') + ui->dpPRMR1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpVAL1lineEdit->text().length(), ' ') + ui->dpVAL1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpPRMR2lineEdit->text().length(), ' ') + ui->dpPRMR2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpVAL2lineEdit->text().length(), ' ') + ui->dpVAL2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpPRMR3lineEdit->text().length(), ' ') + ui->dpPRMR3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpVAL3lineEdit->text().length(), ' ') + ui->dpVAL3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpPRMR4lineEdit->text().length(), ' ') + ui->dpPRMR4lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dpVAL4lineEdit->text().length(), ' ') + ui->dpVAL4lineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (3) CONTROL CARDS\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*CONTROL_TERMINATION\n";
    out << "$   ENDTIM    ENDCYC     DTMIN    ENDNEG    ENDMAS\n";
    out << std::string(VAL_DIST - ui->ctENDTIMlineEdit->text().length(), ' ') + ui->ctENDTIMlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctENDCYClineEdit->text().length(), ' ') + ui->ctENDCYClineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctDTMINlineEdit->text().length(), ' ') + ui->ctDTMINlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctENDNEGlineEdit->text().length(), ' ') + ui->ctENDNEGlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctENDMASlineEdit->text().length(), ' ') + ui->ctENDMASlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_TIMESTEP\n";
    out << "$   DTINIT    TSSFAC      ISDO    TSLIMT     DT2MS      LCTM     ERODE     MS1ST\n";
    out << std::string(VAL_DIST - ui->ctDTINITlineEdit->text().length(), ' ') + ui->ctDTINITlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctTSSFAClineEdit->text().length(), ' ') + ui->ctTSSFAClineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctISDOlineEdit->text().length(), ' ') + ui->ctISDOlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctTSLIMTlineEdit->text().length(), ' ') + ui->ctTSLIMTlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctDT2MSlineEdit->text().length(), ' ') + ui->ctDT2MSlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctLCTMlineEdit->text().length(), ' ') + ui->ctLCTMlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctERODElineEdit->text().length(), ' ') + ui->ctERODElineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctMS1STlineEdit->text().length(), ' ') + ui->ctMS1STlineEdit->text().toStdString() + "\n";
    out << "$   DT2MSF   DT2MSLC     IMSCL\n";
    out << std::string(VAL_DIST - ui->ctDT2MSFlineEdit->text().length(), ' ') + ui->ctDT2MSFlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctDT2MSLClineEdit->text().length(), ' ') + ui->ctDT2MSLClineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->ctIMSCLlineEdit->text().length(), ' ') + ui->ctIMSCLlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_RIGID\n";
    out << "$      LMF      JNTF    ORTHMD     PARTM    SPARSE    METALF\n";
    out << std::string(VAL_DIST - ui->crLMFlineEdit->text().length(), ' ') + ui->crLMFlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->crJNTFlineEdit->text().length(), ' ') + ui->crJNTFlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->crORTHMDlineEdit->text().length(), ' ') + ui->crORTHMDlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->crPARTMlineEdit->text().length(), ' ') + ui->crPARTMlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->crSPARSElineEdit->text().length(), ' ') + ui->crSPARSElineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->crMETALFlineEdit->text().length(), ' ') + ui->crMETALFlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_HOURGLASS\n";
    out << "$      IHQ        QH\n";
    out << std::string(VAL_DIST - ui->chIHQlineEdit->text().length(), ' ') + ui->chIHQlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->chHQlineEdit->text().length(), ' ') + ui->chHQlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_BULK_VISCOSITY\n";
    out << "$       Q1        Q2      TYPE\n";
    out << std::string(VAL_DIST - ui->cbvQ1lineEdit->text().length(), ' ') + ui->cbvQ1lineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->cbvQ2lineEdit->text().length(), ' ') + ui->cbvQ2lineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->cbvTypelineEdit->text().length(), ' ') + ui->cbvTypelineEdit->text().toStdString() + "\n";
    out << "*CONTROL_SHELL\n";
    out << "$   WRPANG     ESORT     IRNXX    ISTUPD    THEORY       BWC     MITER      PROJ\n";
    out << std::string(VAL_DIST - ui->csESORT_1lineEdit->text().length(), ' ') + ui->csESORT_1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csIRNXXlineEdit->text().length(), ' ') + ui->csIRNXXlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csISTUPDlineEdit->text().length(), ' ') + ui->csISTUPDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csTHEORYlineEdit->text().length(), ' ') + ui->csTHEORYlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csBWClineEdit->text().length(), ' ') + ui->csBWClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csMITERlineEdit->text().length(), ' ') + ui->csMITERlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csPROJlineEdit->text().length(), ' ') + ui->csPROJlineEdit->text().toStdString() + "\n";
    out << "$  ROTASCL    INTGRD    LAMSHT    CSTYP6    TSHELL    NFAIL1    NFAIL4\n";
    out << std::string(VAL_DIST - ui->csROTASCLlineEdit->text().length(), ' ') + ui->csROTASCLlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csINTGRDlineEdit->text().length(), ' ') + ui->csINTGRDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csLAMSHTlineEdit->text().length(), ' ') + ui->csLAMSHTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csCSTYP6lineEdit->text().length(), ' ') + ui->csCSTYP6lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csTSHELLlineEdit->text().length(), ' ') + ui->csTSHELLlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csNFAIL1lineEdit->text().length(), ' ') + ui->csNFAIL1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csNFAIL4lineEdit->text().length(), ' ') + ui->csNFAIL4lineEdit->text().toStdString() + "\n";
    out << "$  PSSTUPD    IRQUAD\n";
    out << std::string(VAL_DIST - ui->csPSSTUPDlineEdit->text().length(), ' ') + ui->csPSSTUPDlineEdit->text().toStdString() +
                  std::string(VAL_DIST - ui->csIRQUADlineEdit->text().length(), ' ') + ui->csIRQUADlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_SOLID\n";
    out << "$    ESORT    FMATRX   NIPTETS    SWLOCL\n";
    out << std::string(VAL_DIST - ui->csESORT_2lineEdit->text().length(), ' ') + ui->csESORT_2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csFMATRXlineEdit->text().length(), ' ') + ui->csFMATRXlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csNIPTETSlineEdit->text().length(), ' ') + ui->csNIPTETSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->csSWLOCLlineEdit->text().length(), ' ') + ui->csSWLOCLlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_CONTACT\n";
    out << "$   SLSFAC    RWPNAL    ISLCHK    SHLTHK    PENOPT    THKCHG     ORIEN\n";
    out << std::string(VAL_DIST - ui->ccSLSFAClineEdit->text().length(), ' ') + ui->ccSLSFAClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccRWPNALlineEdit->text().length(), ' ') + ui->ccRWPNALlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccISLCHKlineEdit->text().length(), ' ') + ui->ccISLCHKlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccSHLTHKlineEdit->text().length(), ' ') + ui->ccSHLTHKlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccPENOPTlineEdit->text().length(), ' ') + ui->ccPENOPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccTHKCHGlineEdit->text().length(), ' ') + ui->ccTHKCHGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccORIENlineEdit->text().length(), ' ') + ui->ccORIENlineEdit->text().toStdString() + "\n";
    out << "$   USRSTR    USRFAC     NSBCS    INTERM     XPENE     SSTHK      ECDT   TIEDPRJ\n";
    out << std::string(VAL_DIST - ui->ccUSRSTRlineEdit->text().length(), ' ') + ui->ccUSRSTRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccUSRFAClineEdit->text().length(), ' ') + ui->ccUSRFAClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccNSBCSlineEdit->text().length(), ' ') + ui->ccNSBCSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccINTERMlineEdit->text().length(), ' ') + ui->ccINTERMlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccXPENElineEdit->text().length(), ' ') + ui->ccXPENElineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccSSTHKlineEdit->text().length(), ' ') + ui->ccSSTHKlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ccECDTlineEdit->text().length(), ' ') + ui->ccECDTlineEdit->text().toStdString() +
            std::string(VAL_DIST - ui->ccTIEDRPJlineEdit->text().length(), ' ') + ui->ccTIEDRPJlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_ENERGY\n";
    out << "$     HGEN      RWEN    SLNTEN     RYLEN\n";
    out << std::string(VAL_DIST - ui->ceHGENlineEdit->text().length(), ' ') + ui->ceHGENlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ceRWENlineEdit->text().length(), ' ') + ui->ceRWENlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ceSLNTENlineEdit->text().length(), ' ') + ui->ceSLNTENlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ceRYLENlineEdit->text().length(), ' ') + ui->ceRYLENlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_OUTPUT\n";
    out << "$    NPOPT    NEECHO    NREFUP    IACCOP     OPIFS    IPNINT    IKEDIT\n";
    out << std::string(VAL_DIST - ui->coNPOPTlineEdit->text().length(), ' ') + ui->coNPOPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->coNEECHOlineEdit->text().length(), ' ') + ui->coNEECHOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->coNREFUPlineEdit->text().length(), ' ') + ui->coNREFUPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->coIACCOPlineEdit->text().length(), ' ') + ui->coIACCOPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->coOPIFSlineEdit->text().length(), ' ') + ui->coOPIFSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->coIPNINTlineEdit->text().length(), ' ') + ui->coIPNINTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->coIKEDITlineEdit->text().length(), ' ') + ui->coIKEDITlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_PARALLEL\n";
    out << "$     NCPU    NUMRHS     CONST\n";
    out << std::string(VAL_DIST - ui->cpNCPUlineEdit->text().length(), ' ') + ui->cpNCPUlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->cpNUMRHSlineEdit->text().length(), ' ') + ui->cpNUMRHSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->cpCONSTlineEdit->text().length(), ' ') + ui->cpCONSTlineEdit->text().toStdString() + "\n";
    out << "*CONTROL_ACCURACY\n";
    out << "$      OSU       INN\n";
    out << std::string(VAL_DIST - ui->caOSUlineEdit->text().length(), ' ') + ui->caOSUlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->caINNlineEdit->text().length(), ' ') + ui->caINNlineEdit->text().toStdString() + "\n";
    out << "*INTERFACE_SPRINGBACK_LSDYNA\n";
    out << "$     PSID      NSHV\n";
    out << std::string(VAL_DIST - ui->islPSIDlineEdit->text().length(), ' ') + ui->islPSIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->islNSHVlineEdit->text().length(), ' ') + ui->islNSHVlineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "       $*DATABASE_OPTION\n";
    out << "$       DT    BINARY\n";
    out << "$OPTION : SECFORC RWFORC NODOUT ELOUT  GLSTAT\n";
    out << "$         DEFORC  MATSUM NCFORC RCFORC DEFGEO\n";
    out << "$         SPCFORC SWFORC ABSTAT NODFOR BNDOUT\n";
    out << "$         RBDOUT  GCEOUT SLEOUT MPGS   SBTOUT\n";
    out << "$         JNTFORC AVSFLT MOVIE\n";
    out << "*DATABASE_RCFORC\n";
    out << std::string(VAL_DIST - ui->dRCFORClineEdit->text().length(), ' ') + ui->dRCFORClineEdit->text().toStdString() + "\n";
    out << "*DATABASE_MATSUM\n";
    out << std::string(VAL_DIST - ui->dMATSUMlineEdit->text().length(), ' ') + ui->dMATSUMlineEdit->text().toStdString() + "\n";
    out << "*DATABASE_GLSTAT\n";
    out << std::string(VAL_DIST - ui->dGLSTATlineEdit->text().length(), ' ') + ui->dGLSTATlineEdit->text().toStdString() + "\n";
    out << "*DATABASE_SLEOUT\n";
    out << std::string(VAL_DIST - ui->dSLEOUTlineEdit->text().length(), ' ') + ui->dSLEOUTlineEdit->text().toStdString() + "\n";
    out << "*DATABASE_RBDOUT\n";
    out << std::string(VAL_DIST - ui->dRBDOUTlineEdit->text().length(), ' ') + ui->dRBDOUTlineEdit->text().toStdString() + "\n";
    out << "*DATABASE_BNDOUT\n";
    out << std::string(VAL_DIST - ui->dBNDOUTlineEdit->text().length(), ' ') + ui->dBNDOUTlineEdit->text().toStdString() + "\n";
    out << "*DATABASE_ABSTAT\n";
    out << std::string(VAL_DIST - ui->dABSTATlineEdit->text().length(), ' ') + ui->dABSTATlineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*DATABASE_BINARY_D3PLOT\n";
    out << "$  DT/CYCL      LCDT      BEAM\n";
    out << std::string(VAL_DIST - ui->dbdDTCYCLlineEdit->text().length(), ' ') + ui->dbdDTCYCLlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dbdLCDTlineEdit->text().length(), ' ') + ui->dbdLCDTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dbdBEAMlineEdit->text().length(), ' ') + ui->dbdBEAMlineEdit->text().toStdString() + "\n";
    out << "*DATABASE_EXTENT_BINARY\n";
    out << "$    NEIPH     NEIPS    MAXINT    STRFLG    SIGFLG    EPSFLG    RLTFLG    ENGFLG\n";
    out << std::string(VAL_DIST - ui->debNEIPHlineEdit->text().length(), ' ') + ui->debNEIPHlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debNEIPSlineEdit->text().length(), ' ') + ui->debNEIPSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debMAXINTlineEdit->text().length(), ' ') + ui->debMAXINTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debSTRFLGlineEdit->text().length(), ' ') + ui->debSTRFLGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debSIGFLGlineEdit->text().length(), ' ') + ui->debSIGFLGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debEPSFLGlineEdit->text().length(), ' ') + ui->debEPSFLGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debRLTFLGlineEdit->text().length(), ' ') + ui->debRLTFLGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debENGFLGlineEdit->text().length(), ' ') + ui->debENGFLGlineEdit->text().toStdString() + "\n";
    out << "$   CMPFLG    IEVERP    BEAMIP     DCOMP      SHGE     STSSZ\n";
    out << std::string(VAL_DIST - ui->debCMPFLGlineEdit->text().length(), ' ') + ui->debCMPFLGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debIEVERPlineEdit->text().length(), ' ') + ui->debIEVERPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debBEAMIPlineEdit->text().length(), ' ') + ui->debBEAMIPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debDCOMPlineEdit->text().length(), ' ') + ui->debDCOMPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debSHGElineEdit->text().length(), ' ') + ui->debSHGElineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->debSTSSZlineEdit->text().length(), ' ') + ui->debSTSSZlineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (4) DEFINE BLANK\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*SET_PART_LIST\n";
    out << "$SET_PART_NAME: BLANK\n";
    out << "$      SID       DA1       DA2       DA3       DA4\n";
    out << std::string(VAL_DIST - ui->spl4SIDlineEdit->text().length(), ' ') + ui->spl4SIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4DA1lineEdit->text().length(), ' ') + ui->spl4DA1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4DA2lineEdit->text().length(), ' ') + ui->spl4DA2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4DA3lineEdit->text().length(), ' ') + ui->spl4DA3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4DA4lineEdit->text().length(), ' ') + ui->spl4DA4lineEdit->text().toStdString() + "\n";
    out << "$     PID1      PID2      PID3      PID4      PID5      PID6      PID7      PID8\n";
    out << std::string(VAL_DIST - ui->spl4PID1lineEdit->text().length(), ' ') + ui->spl4PID1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID2lineEdit->text().length(), ' ') + ui->spl4PID2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID3lineEdit->text().length(), ' ') + ui->spl4PID3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID4lineEdit->text().length(), ' ') + ui->spl4PID4lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID5lineEdit->text().length(), ' ') + ui->spl4PID5lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID6lineEdit->text().length(), ' ') + ui->spl4PID6lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID7lineEdit->text().length(), ' ') + ui->spl4PID7lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl4PID8lineEdit->text().length(), ' ') + ui->spl4PID8lineEdit->text().toStdString() + "\n";
    out << "*PART\n";
    out << "$HEADING\n";
    out << " PART PID =        7 PART NAME :TOPSRF 1\n";
    out << "$      PID     SECID       MID     EOSID      HGID      GRAV    ADPOPT      TMID\n";
    out << std::string(VAL_DIST - ui->part4PIDlineEdit->text().length(), ' ') + ui->part4PIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4SECIDlineEdit->text().length(), ' ') + ui->part4SECIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4MIDlineEdit->text().length(), ' ') + ui->part4MIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4EOSIDlineEdit->text().length(), ' ') + ui->part4EOSIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4HGIDlineEdit->text().length(), ' ') + ui->part4HGIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4GRAVlineEdit->text().length(), ' ') + ui->part4GRAVlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4ADPOPTlineEdit->text().length(), ' ') + ui->part4ADPOPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part4TMIDlineEdit->text().length(), ' ') + ui->part4TMIDlineEdit->text().toStdString() + "\n";
    out << "*MAT_TRANSVERSELY_ANISOTROPIC_ELASTIC_PLASTIC\n";
    out << "$MATERIAL NAME:AA3104H19\n";
    out << "$      MID        RO         E        PR      SIGY      ETAN         R     HLCID\n";
    out << std::string(VAL_DIST - ui->mtaep4MIDlineEdit->text().length(), ' ') + ui->mtaep4MIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4ROlineEdit->text().length(), ' ') + ui->mtaep4ROlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4ElineEdit->text().length(), ' ') + ui->mtaep4ElineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4PRlineEdit->text().length(), ' ') + ui->mtaep4PRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4SIGYlineEdit->text().length(), ' ') + ui->mtaep4SIGYlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4ETANlineEdit->text().length(), ' ') + ui->mtaep4ETANlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4RlineEdit->text().length(), ' ') + ui->mtaep4RlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mtaep4HLCIDlineEdit->text().length(), ' ') + ui->mtaep4HLCIDlineEdit->text().toStdString() + "\n";
    out << "*SECTION_SHELL\n";
    out << "$    SECID    ELFORM      SHRF       NIP     PROPT   QR/IRID     ICOMP     SETYP           \n";
    out << std::string(VAL_DIST - ui->ss4SECIDlineEdit->text().length(), ' ') + ui->ss4SECIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4ELFORMlineEdit->text().length(), ' ') + ui->ss4ELFORMlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4SHRFlineEdit->text().length(), ' ') + ui->ss4SHRFlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4NIPlineEdit->text().length(), ' ') + ui->ss4NIPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4PROPTlineEdit->text().length(), ' ') + ui->ss4PROPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4QRIRIDlineEdit->text().length(), ' ') + ui->ss4QRIRIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4ICOMPlineEdit->text().length(), ' ') + ui->ss4ICOMPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4SETYPlineEdit->text().length(), ' ') + ui->ss4SETYPlineEdit->text().toStdString() + "\n";
    out << "$       T1        T2        T3        T4      NLOC\n";
    out << std::string(VAL_DIST - ui->ss4T1lineEdit->text().length(), ' ') + ui->ss4T1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4T2lineEdit->text().length(), ' ') + ui->ss4T2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4T3lineEdit->text().length(), ' ') + ui->ss4T3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4T4lineEdit->text().length(), ' ') + ui->ss4T4lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss4NLOClineEdit->text().length(), ' ') + ui->ss4NLOClineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (5) DEFINE TOOLS\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$                    TOOL < stol >\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*SET_PART_LIST\n";
    out << "$SET_PART_NAME: stol\n";
    out << "$      SID       DA1       DA2       DA3       DA4\n";
    out << std::string(VAL_DIST - ui->spl5SIDlineEdit->text().length(), ' ') + ui->spl5SIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5DA1lineEdit->text().length(), ' ') + ui->spl5DA1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5DA2lineEdit->text().length(), ' ') + ui->spl5DA2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5DA3lineEdit->text().length(), ' ') + ui->spl5DA3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5DA4lineEdit->text().length(), ' ') + ui->spl5DA4lineEdit->text().toStdString() + "\n";
    out << "$     PID1      PID2      PID3      PID4      PID5      PID6      PID7      PID8\n";
    out << std::string(VAL_DIST - ui->spl5PID1lineEdit->text().length(), ' ') + ui->spl5PID1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID2lineEdit->text().length(), ' ') + ui->spl5PID2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID3lineEdit->text().length(), ' ') + ui->spl5PID3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID4lineEdit->text().length(), ' ') + ui->spl5PID4lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID5lineEdit->text().length(), ' ') + ui->spl5PID5lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID6lineEdit->text().length(), ' ') + ui->spl5PID6lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID7lineEdit->text().length(), ' ') + ui->spl5PID7lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->spl5PID8lineEdit->text().length(), ' ') + ui->spl5PID8lineEdit->text().toStdString() + "\n";
    out << "*PART\n";
    out << "$HEADING\n";
    out << " PART PID =        3 PART NAME :DIE2\n";
    out << "$      PID     SECID       MID     EOSID      HGID      GRAV    ADPOPT      TMID\n";
    out << std::string(VAL_DIST - ui->part5PIDlineEdit->text().length(), ' ') + ui->part5PIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5SECIDlineEdit->text().length(), ' ') + ui->part5SECIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5MIDlineEdit->text().length(), ' ') + ui->part5MIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5EOSIDlineEdit->text().length(), ' ') + ui->part5EOSIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5HGIDlineEdit->text().length(), ' ') + ui->part5HGIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5GRAVlineEdit->text().length(), ' ') + ui->part5GRAVlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5ADPOPTlineEdit->text().length(), ' ') + ui->part5ADPOPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->part5TMIDlineEdit->text().length(), ' ') + ui->part5TMIDlineEdit->text().toStdString() + "\n";
    out << "*MAT_RIGID\n";
    out << "$      MID        RO         E        PR         N    COUPLE         M     ALIAS\n";
    out << std::string(VAL_DIST - ui->mr5MIDlineEdit->text().length(), ' ') + ui->mr5MIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5ROlineEdit->text().length(), ' ') + ui->mr5ROlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5ElineEdit->text().length(), ' ') + ui->mr5ElineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5PRlineEdit->text().length(), ' ') + ui->mr5PRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5NlineEdit->text().length(), ' ') + ui->mr5NlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5COUPLElineEdit->text().length(), ' ') + ui->mr5COUPLElineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5MlineEdit->text().length(), ' ') + ui->mr5MlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5ALIASlineEdit->text().length(), ' ') + ui->mr5ALIASlineEdit->text().toStdString() + "\n";
    out << "$      CMO      CON1      CON2\n";
    out << std::string(VAL_DIST - ui->mr5CM0lineEdit->text().length(), ' ') + ui->mr5CM0lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5CON1lineEdit->text().length(), ' ') + ui->mr5CON1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5CON2lineEdit->text().length(), ' ') + ui->mr5CON2lineEdit->text().toStdString() + "\n";
    out << "$LCO or A1        A2        A3        V1        V2        V3\n";
    out << std::string(VAL_DIST - ui->mr5A1lineEdit->text().length(), ' ') + ui->mr5A1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5A2lineEdit->text().length(), ' ') + ui->mr5A2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5A3lineEdit->text().length(), ' ') + ui->mr5A3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5V1lineEdit->text().length(), ' ') + ui->mr5V1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5V2lineEdit->text().length(), ' ') + ui->mr5V2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->mr5V3lineEdit->text().length(), ' ') + ui->mr5V3lineEdit->text().toStdString() + "\n";
    out << "*SECTION_SHELL\n";
    out << "$    SECID    ELFORM      SHRF       NIP     PROPT   QR/IRID     ICOMP     SETYP\n";
    out << std::string(VAL_DIST - ui->ss5SECIDlineEdit->text().length(), ' ') + ui->ss5SECIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5ELFORMlineEdit->text().length(), ' ') + ui->ss5ELFORMlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5SHRFlineEdit->text().length(), ' ') + ui->ss5SHRFlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5NIPlineEdit->text().length(), ' ') + ui->ss5NIPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5PROPTlineEdit->text().length(), ' ') + ui->ss5PROPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5QRIRIDlineEdit->text().length(), ' ') + ui->ss5QRIRIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5ICOMPlineEdit->text().length(), ' ') + ui->ss5ICOMPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5SETYPlineEdit->text().length(), ' ') + ui->ss5SETYPlineEdit->text().toStdString() + "\n";
    out << "$       T1        T2        T3        T4      NLOC\n";
    out << std::string(VAL_DIST - ui->ss5T1lineEdit->text().length(), ' ') + ui->ss5T1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5T2lineEdit->text().length(), ' ') + ui->ss5T2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5T3lineEdit->text().length(), ' ') + ui->ss5T3lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5T4lineEdit->text().length(), ' ') + ui->ss5T4lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->ss5NLOClineEdit->text().length(), ' ') + ui->ss5NLOClineEdit->text().toStdString() + "\n";
    out << "*CONTACT_AUTOMATIC_SURFACE_TO_SURFACE_ID\n";
    out << "$      CID  CONTACT INTERFACE TITLE\n";
    out << std::string(VAL_DIST - ui->castsi5CIDlineEdit->text().length(), ' ') + ui->castsi5CIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5CITlineEdit->text().length(), ' ') + ui->castsi5CITlineEdit->text().toStdString() + "\n";
    out << "$     SSID      MSID     SSTYP     MSTYP    SBOXID    MBOXID       SPR       MPR\n";
    out << std::string(VAL_DIST - ui->castsi5SSIDlineEdit->text().length(), ' ') + ui->castsi5SSIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5MSIDlineEdit->text().length(), ' ') + ui->castsi5MSIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SSTYPlineEdit->text().length(), ' ') + ui->castsi5SSTYPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5MSTYPlineEdit->text().length(), ' ') + ui->castsi5MSTYPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SBOXIDlineEdit->text().length(), ' ') + ui->castsi5SBOXIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5MBOXIDlineEdit->text().length(), ' ') + ui->castsi5MBOXIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SPRlineEdit->text().length(), ' ') + ui->castsi5SPRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5MPRlineEdit->text().length(), ' ') + ui->castsi5MPRlineEdit->text().toStdString() + "\n";
    out << "$       FS        FD        DC        VC       VDC    PENCHK        BT        DT\n";
    out << std::string(VAL_DIST - ui->castsi5FSlineEdit->text().length(), ' ') + ui->castsi5FSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5FDlineEdit->text().length(), ' ') + ui->castsi5FDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5DClineEdit->text().length(), ' ') + ui->castsi5DClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5VClineEdit->text().length(), ' ') + ui->castsi5VClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5VDClineEdit->text().length(), ' ') + ui->castsi5VDClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5PENCHKlineEdit->text().length(), ' ') + ui->castsi5PENCHKlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5BTlineEdit->text().length(), ' ') + ui->castsi5BTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5DTlineEdit->text().length(), ' ') + ui->castsi5DTlineEdit->text().toStdString() + "\n";
    out << "$      SFS       SFM       SST       MST      SFST      SFMT       FSF       VSF\n";
    out << std::string(VAL_DIST - ui->castsi5SFSlineEdit->text().length(), ' ') + ui->castsi5SFSlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SFMlineEdit->text().length(), ' ') + ui->castsi5SFMlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SSTlineEdit->text().length(), ' ') + ui->castsi5SSTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5MSTlineEdit->text().length(), ' ') + ui->castsi5MSTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SFSTlineEdit->text().length(), ' ') + ui->castsi5SFSTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SFMTlineEdit->text().length(), ' ') + ui->castsi5SFMTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5FSFlineEdit->text().length(), ' ') + ui->castsi5FSFlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5VSFlineEdit->text().length(), ' ') + ui->castsi5VSFlineEdit->text().toStdString() + "\n";
    out << "$     SOFT    SOFSCL    LCIDAB    MAXPAR    PENTOL     DEPTH     BSORT    FRCFRQ\n";
    out << std::string(VAL_DIST - ui->castsi5SOFTlineEdit->text().length(), ' ') + ui->castsi5SOFTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SOFSCLlineEdit->text().length(), ' ') + ui->castsi5SOFSCLlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5LCIDABlineEdit->text().length(), ' ') + ui->castsi5LCIDABlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5MAXPARlineEdit->text().length(), ' ') + ui->castsi5MAXPARlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5PENTOLlineEdit->text().length(), ' ') + ui->castsi5PENTOLlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5DEPTHlineEdit->text().length(), ' ') + ui->castsi5DEPTHlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5BSORTlineEdit->text().length(), ' ') + ui->castsi5BSORTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5FRCFRQlineEdit->text().length(), ' ') + ui->castsi5FRCFRQlineEdit->text().toStdString() + "\n";
    out << "$   PENMAX    THKOPT    SHLTHK     SNLOG      ISYM     I2D3D    SLDTHK    SLDSTF\n";
    out << std::string(VAL_DIST - ui->castsi5PENMAXlineEdit->text().length(), ' ') + ui->castsi5PENMAXlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5THKOPTlineEdit->text().length(), ' ') + ui->castsi5THKOPTlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SHLTHKlineEdit->text().length(), ' ') + ui->castsi5SHLTHKlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SNLOGlineEdit->text().length(), ' ') + ui->castsi5SNLOGlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5ISYMlineEdit->text().length(), ' ') + ui->castsi5ISYMlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5I2D3DlineEdit->text().length(), ' ') + ui->castsi5I2D3DlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SLDTHKlineEdit->text().length(), ' ') + ui->castsi5SLDTHKlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5SLDSTFlineEdit->text().length(), ' ') + ui->castsi5SLDSTFlineEdit->text().toStdString() + "\n";
    out << "$     IGAP    IGNORE    DPRFAC    DTSTIF                        FLANGL\n";
    out << std::string(VAL_DIST - ui->castsi5IGAPlineEdit->text().length(), ' ') + ui->castsi5IGAPlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5IGNORElineEdit->text().length(), ' ') + ui->castsi5IGNORElineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5DPRFAClineEdit->text().length(), ' ') + ui->castsi5DPRFAClineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5DTSTIFlineEdit->text().length(), ' ') + ui->castsi5DTSTIFlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->castsi5FLANGLlineEdit->text().length(), ' ') + ui->castsi5FLANGLlineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (6) DEFINE PROCESS STEPS\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$                    STEP < cisnienie >\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$stol : stationary\n";
    out << "*LOAD_MASK\n";
    out << "$      PID      LCID      VID1       OFF     BOXID     LCIDM      VID2     INOUT\n";
    out << std::string(VAL_DIST - ui->lmPIDlineEdit->text().length(), ' ') + ui->lmPIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmLCIDlineEdit->text().length(), ' ') + ui->lmLCIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmVID1lineEdit->text().length(), ' ') + ui->lmVID1lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmOFFlineEdit->text().length(), ' ') + ui->lmOFFlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmBOXIDlineEdit->text().length(), ' ') + ui->lmBOXIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmLCIDMlineEdit->text().length(), ' ') + ui->lmLCIDMlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmVID2lineEdit->text().length(), ' ') + ui->lmVID2lineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->lmINOUTlineEdit->text().length(), ' ') + ui->lmINOUTlineEdit->text().toStdString() + "\n";
    out << "$   ICYCLE\n";
    out << std::string(VAL_DIST - ui->lmICYCLElineEdit->text().length(), ' ') + ui->lmICYCLElineEdit->text().toStdString() + "\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (7) DEFINE CURVES\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*DEFINE_CURVE\n";
    out << "$D3PLOT\n";
    out << "$     LCID      SIDR      SCLA      SCLO      OFFA      OFFO    DATTYP\n";
    out << std::string(VAL_DIST - ui->dc1LCIDlineEdit->text().length(), ' ') + ui->dc1LCIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc1SIDRlineEdit->text().length(), ' ') + ui->dc1SIDRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc1SCLAlineEdit->text().length(), ' ') + ui->dc1SCLAlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc1SCLOlineEdit->text().length(), ' ') + ui->dc1SCLOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc1OFFAlineEdit->text().length(), ' ') + ui->dc1OFFAlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc1OFFOlineEdit->text().length(), ' ') + ui->dc1OFFOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc1DATTYPlineEdit->text().length(), ' ') + ui->dc1DATTYPlineEdit->text().toStdString() + "\n";
    out << "$                 A1                  O1\n";
    for (int i = 0; i < 2; ++i)
    {
        out << std::string(2*VAL_DIST - ui->dc1A1comboBox->itemText(i).length(), ' ') + ui->dc1A1comboBox->itemText(i).toStdString() +
               std::string(2*VAL_DIST - ui->dc1O1comboBox->itemText(i).length(), ' ') + ui->dc1O1comboBox->itemText(i).toStdString() + "\n";
    }
    out << "*DEFINE_CURVE\n";
    out << "$SSC\n";
    out << "$     LCID      SIDR      SCLA      SCLO      OFFA      OFFO    DATTYP\n";
    out << std::string(VAL_DIST - ui->dc2LCIDlineEdit->text().length(), ' ') + ui->dc2LCIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc2SIDRlineEdit->text().length(), ' ') + ui->dc2SIDRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc2SCLAlineEdit->text().length(), ' ') + ui->dc2SCLAlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc2SCLOlineEdit->text().length(), ' ') + ui->dc2SCLOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc2OFFAlineEdit->text().length(), ' ') + ui->dc2OFFAlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc2OFFOlineEdit->text().length(), ' ') + ui->dc2OFFOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc2DATTYPlineEdit->text().length(), ' ') + ui->dc2DATTYPlineEdit->text().toStdString() + "\n";
    out << "$                 A1                  O1\n";
    for (int i = 0; i < 101; ++i)
    {
        out << std::string(2*VAL_DIST - ui->dc2A1comboBox->itemText(i).length(), ' ') + ui->dc2A1comboBox->itemText(i).toStdString() +
               std::string(2*VAL_DIST - ui->dc2O1comboBox->itemText(i).length(), ' ') + ui->dc2O1comboBox->itemText(i).toStdString() + "\n";
    }
    out << "*DEFINE_CURVE\n";
    out << "$PRESSURE\n";
    out << "$     LCID      SIDR      SCLA      SCLO      OFFA      OFFO    DATTYP\n";
    out << std::string(VAL_DIST - ui->dc3LCIDlineEdit->text().length(), ' ') + ui->dc3LCIDlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc3SIDRlineEdit->text().length(), ' ') + ui->dc3SIDRlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc3SCLAlineEdit->text().length(), ' ') + ui->dc3SCLAlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc3SCLOlineEdit->text().length(), ' ') + ui->dc3SCLOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc3OFFAlineEdit->text().length(), ' ') + ui->dc3OFFAlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc3OFFOlineEdit->text().length(), ' ') + ui->dc3OFFOlineEdit->text().toStdString() +
           std::string(VAL_DIST - ui->dc3DATTYPlineEdit->text().length(), ' ') + ui->dc3DATTYPlineEdit->text().toStdString() + "\n";
    out << "$                 A1                  O1\n";
    for (int i = 0; i < 2; ++i)
    {
        out << std::string(2*VAL_DIST - ui->dc3A1comboBox->itemText(i).length(), ' ') + ui->dc3A1comboBox->itemText(i).toStdString() +
               std::string(2*VAL_DIST - ui->dc3O1comboBox->itemText(i).length(), ' ') + ui->dc3O1comboBox->itemText(i).toStdString() + "\n";
    }
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "$\n";
    out << "$                    (8) MODEL DATA\n";
    out << "$\n";
    out << "$---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8\n";
    out << "*INCLUDE\n";
    out << ui->inc1lineEdit->text().toStdString() + "\n";
    out << "$\n";
    out << "*INCLUDE\n";
    out << ui->inc2lineEdit->text().toStdString() + "\n";
    out << "*END\n";

    out.close();

}
